<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ include file="/view/common/header-talent.jsp" %> 
  
    
 <div class="alert alert-info alert-dismissible fade in" role="alert">
      <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>
      <strong><h3><center>求职者个人资料</center></h3></strong>
    </div>
     <hr>
     
<form action="<%=request.getContextPath() %>/TalentServlet?command=update" method="post">

  <div class="form-group">账号:
    <input type="text" class="form-control" disabled="disabled" id= "code" name="code"  value="${sessionScope.talent.code }">

  </div>
  <div class="form-group">密码:
    <input type="text" class="form-control" name="password"   value="${sessionScope.talent.passWord }">
  </div>
  
    <div class="form-group">姓名:
    <input type="text" class="form-control" id= "name" name="name" value="${sessionScope.talent.name}">
  </div>
  <div class="form-group">邮箱:
    <input type="text" class="form-control" id= "email" name="email"  value="${sessionScope.talent.email}">
  </div>
  
   <div class="form-group">电话:
    <input type="text" class="form-control" id= "phone" name="phone"  value="${sessionScope.talent.phone}">
  </div>
  <div class="form-group">年龄:
      <select class="form-control"  name="age" id= "age">
        <option value="">-请选择年龄-</option>
        <script>
         for(var i =16;i<30;i++){
        	 //如果要在js代码上写EL，这个js代码必须卸载jsp页面上，不可以使用外部引入!
        	 var age = '${sessionScope.talent.age}';
        	  if( i == age){
        		  document.write('<option selected="selected">'+i+'</option>');
        	  }else{
        	      document.write('<option>'+i+'</option>');
        	  }
         }
        </script>
   
 </select>
  </div>
  
  <div class="radio">性别:
  <c:if test="${sessionScope.talent.gender == 1}">
   <label>
      <input type="radio" name="gender" checked="checked" value="1"> 男
   </label>
   <label>
      <input type="radio" name="gender" value="2"> 女
    </label>
  </c:if>
  <c:if test="${sessiontScope.talent.gender == 2}"> 
   <label>
      <input type="radio" name="gender"  value="1"> 男
        </label>
        <label>
      <input type="radio" name="gender"  checked="checked" value="2"> 女
    </label>
 </c:if>
</div>
  
  <div class="checkbox">爱好:
    <label>
      <input type="checkbox" value="读书" name="hobby"> 读书
    </label>
     <label>
      <input type="checkbox" value="编程" name="hobby"> 编程
    </label>
     <label>
      <input type="checkbox" value="看电影" name="hobby"> 看电影
    </label>
     <label>
      <input type="checkbox" value="游泳" name="hobby"> 游泳
    </label>
  </div>
  <div class="form-group">
    <input   type="submit" class="btn btn-info" value="修改"></input>
      <input   type="submit" class="btn btn-success"  onclick="history.back()" value="返回"></input>
  </div> 
</form>
<script>
	 /**
	  * 多选框的回显
	  */
    var hobby = '${sessionScope.talent.hobby}';
    if(hobby){
      var hobbies = hobby.split("|");  
    	//var allHobbies= document.getElementsByName("hobby");  //得到的是框框
    	
    	// for (var i = 0;  i< hobbies.length; i++) {
		//	  for (var j = 0; j< allHobbies.length; j++) {
	    //	    if (hobbies[i] == allHobbies[j].value) {
	    //	      allHobbies[j].checked = true;
	    //      }
	    //   }
		//  }	
    	
    	$(":checkbox").val(hobbies);
    	
    	/**
    	 * layer弹出层
    	 */
    	 if ('${param.updateSuccess}') {
			  layer.msg('个人资料修改成功~',{icon : 1});
		}
    	if ('${param.updateError}') {
    		 layer.msg('个人资料修改失败~',{icon : 0});
		}
    }
</script>
</body>
</html>